#include <gtest/gtest.h>
#include <unordered_map>

class Mytest : public testing::Test
{
public:
    static void SetUpTestCase()
    {
        std::cout << "总体环境的初始化" << std::endl;
    }

    virtual void SetUp() override
    {
        // 在这里插入每个单元测试所需的独立的测试数据
        std::cout << "单元测试初始化！！\n";
        _mymap.insert(std::make_pair("hello", "你好"));
        _mymap.insert(std::make_pair("bye", "再见"));
    }

    virtual void TearDown() override
    {
        // 每个单元测试的清理
        _mymap.clear();
        std::cout << "单元测试的清理" << std::endl;
    }

    static void TearDownTestCase()
    {

        std::cout << "总体环境的清理" << std::endl;
    }

public:
    std::unordered_map<std::string, std::string> _mymap;
};

TEST_F(Mytest, insert_test)
{
    _mymap.insert(std::make_pair("你好", "hello"));
    ASSERT_EQ(_mymap.size(), 3);
}

TEST_F(Mytest, sizeof)
{
    ASSERT_EQ(_mymap.size(), 2);
}

int main(int argc, char *argv[])
{
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}